#include"head.h"


void Show_Calculate(Information s[], int n)	/*展示工资计算单*/
{
	Calculate(s, n);
	
	printf("姓名:\t基本工资:\t岗位津贴:\t物价补贴:\t职务补贴:\t住房补贴:\t病假扣款:\t事假扣款:\t旷工扣款:\t其他扣款:\t加班总费:\t夜班总费:\t实际工资:\n");
	
	for(int i  = 0; i < n ; i++)
	{
		
		printf("%s:\t+%-16d+%-16d+%-16d+%-16d+%-12d-%-16lf-%-16d-%-16d-%-16d+%-12d+%-12d%-16lf\n",s[i].name,s[i].base,s[i].job,s[i].price,s[i].post,s[i].live,s[i].sick,s[i].thing*s[i].busy_thing,s[i].free*s[i].free_work,s[i].other,s[i].overtime*s[i].add_work,s[i].night_differential*s[i].night,s[i].realmoney);
		printf("\n");
	}
	
	return ;
}

void Show_individual(Information s[], int n)	/*展示个人工资单*/
{
	Calculate(s, n);
	
	fflush(stdin);
	char Appointname[20];
	printf("请输入想要展示工资的职员姓名：");
	gets(Appointname);
	
	int flag;
	for (int i=0; i<n; i++)
	{
		if (strcmp(s[i].name,Appointname)==0)
		{
			flag=1;
			printf("姓名:\t基本工资:\t岗位津贴:\t物价补贴:\t职务补贴:\t住房补贴:\t病假扣款:\t事假扣款:\t旷工扣款:\t其他扣款:\t加班总费:\t夜班总费:\t实际工资\n");
			printf("%-8s:%-16d%-16d%-16d%-16d%-16d%-16lf%-16d%-16d%-16d%-16d%-16d%-16lf\n",s[i].name,s[i].base,s[i].job,s[i].price,s[i].post,s[i].live,s[i].sick,s[i].thing*s[i].busy_thing,s[i].free*s[i].free_work,s[i].other,s[i].overtime*s[i].add_work,s[i].night_differential*s[i].night,s[i].realmoney);
			printf("\n");
			
		}
	}
	if(flag!=1)
	{
		printf("未找到！！！\n");
	}
	
	return ;
}

void Show_section(Information s[], int n)	/*展示部门工资单*/
{
	fflush(stdin);
	char appointsection[20];
	printf("请输入想要展示月工资的部门：");
	gets(appointsection);
	
	Calculate(s, n);
	
	printf("%s部门的职员工资单：\n",appointsection);
	
	int flag;
	
	for (int i=0; i<n; i++)
	{
		if (strcmp(s[i].section,appointsection)==0)
		{
			flag=1;
			printf("姓名:\t基本工资:\t岗位津贴:\t物价补贴:\t职务补贴:\t住房补贴:\t病假扣款:\t事假扣款:\t旷工扣款:\t其他扣款:\t加班总费:\t夜班总费:\t实际工资\n");
			printf("%-8s:%-16d%-16d%-16d%-16d%-16d%-16lf%-16d%-16d%-16d%-16d%-16d%-16lf\n",s[i].name,s[i].base,s[i].job,s[i].price,s[i].post,s[i].live,s[i].sick,s[i].thing*s[i].busy_thing,s[i].free*s[i].free_work,s[i].other,s[i].overtime*s[i].add_work,s[i].night_differential*s[i].night,s[i].realmoney);
			printf("\n");
		}
		
	}
	if (flag!=1)
	{
		printf("未找到！！！\n");
	}
	return ;
}

void Show_All(Information s[], int n)	/*展示汇总表*/
{
	Calculate(s, n);
	
	printf("姓名:\t基本工资:\t岗位津贴:\t物价补贴:\t职务补贴:\t住房补贴:\t病假扣款:\t事假扣款:\t旷工扣款:\t其他扣款:\t加班总费:\t夜班总费:\t实际工资\n");
	for (int i=0; i<n; i++)
	{
		printf("%-8s:%-16d%-16d%-16d%-16d%-16d%-16lf%-16d%-16d%-16d%-16d%-16d%-16lf\n",s[i].name,s[i].base,s[i].job,s[i].price,s[i].post,s[i].live,s[i].sick,s[i].thing*s[i].busy_thing,s[i].free*s[i].free_work,s[i].other,s[i].overtime*s[i].add_work,s[i].night_differential*s[i].night,s[i].realmoney);
		printf("\n");
	}
	return ;
}